package main

import (
	"fmt"
	"github.com/boltdb/bolt"
)

func main() {
	db, e := bolt.Open("test.db", 0600, nil)
	if e != nil {
		panic(e)
	}
	e = db.Update(func(tx *bolt.Tx) error {
		//bucket, err := tx.CreateBucketIfNotExists([]byte("test"))
		//if err != nil {
		//	fmt.Println(err)
		//}
		//bucket.Put([]byte("hello"),[]byte("world"))
		//bucket.Put([]byte("hello1"),[]byte("world1"))
		//return nil

		bucket := tx.Bucket([]byte("test"))
		res := bucket.Get([]byte("hello1"))
		fmt.Println(string(res))
		return nil
	})
	if e != nil{
		fmt.Println(e)
	}
}
